<template>
  <div class="brother">
    <h1>I`m the brother</h1>
    <p>我就{{ house }}栋house</p>
    <p>我找了个富婆,名字叫:{{ bgfname }}</p>
    <button @click="tellname">告诉我兄弟</button>
  </div>
</template>

<script>
import eventBus from "@/utils/myeventbus.js";
export default {
  data() {
    return {
      house: 10,
      bgfname: "小红BB",
    };
  },
  methods: {
    tellname() {
      //1.0通过事件总线发出事件
      //$emit(自定义事件类型,传递的数据)
      eventBus.$emit("brother_getbgfname", this.bgfname);
    },
  },
};
</script>

<style lang="less" scoped>
.brother {
  width: 100%;
  background-color: greenyellow;
  padding: 10px;
  margin-top: 10px;
}
</style>